package com.x.wx.service;

import java.util.List;

import com.alibaba.dubbo.config.annotation.Service;
import com.x.wx.rpc.WxKeywordRpcService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.x.framework.exception.BusinessException;
import com.x.framework.exception.ExceptionCode;
import com.x.framework.service.BaseService;
import com.x.wx.dao.WxKeywordDao;
import com.x.wx.model.WxKeyword;

@Component
@Service(interfaceName = "com.x.wx.rpc.WxKeywordRpcService", timeout = 10000)
public class WxKeywordService extends BaseService implements WxKeywordRpcService {

	@Autowired
	private WxKeywordDao wxKeywordDao;
	
	public WxKeyword insertWxKeyword(WxKeyword wxKeyword) {
		try {
			return this.insert(wxKeyword);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public int updateWxKeyword(WxKeyword wxKeyword) {
		try {
			return this.update(wxKeyword);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public List<WxKeyword> selectWxKeywordList(WxKeyword wxKeyword) {
		try {
			return wxKeywordDao.selectWxKeywordList(wxKeyword);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public int selectWxKeywordNum(WxKeyword wxKeyword) {
		try {
			return wxKeywordDao.selectWxKeywordNum(wxKeyword);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

	public int deleteWxKeyword(WxKeyword wxKeyword) {
		try {
			return this.delete(wxKeyword);
		} catch (Exception e) {
			throw new BusinessException(ExceptionCode.EXCEPTION_CODE0000, e);
		}
	}

}
